Adding some more judges, here and there.
[andmenj-acm.git] / COCI / 2010-2011 / Contest #1 - 22.10.2010 / matrix / bruteforce.cpp
blobfa27998875b7f6162c2b0aaae59d080108597fea
1 // Andrés Mejía
2 using namespace std;
3 #include <algorithm>
4 #include <iostream>
5 #include <iterator>
6 #include <numeric>
7 #include <sstream>
8 #include <fstream>
9 #include <cassert>
10 #include <climits>
11 #include <cstdlib>
12 #include <cstring>
13 #include <string>
14 #include <cstdio>
15 #include <vector>
16 #include <cmath>
17 #include <queue>
18 #include <deque>
19 #include <stack>
20 #include <list>
21 #include <map>
22 #include <set>
24 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define D(x) cout << #x " is " << x << endl
28 const double EPS = 1e-9;
29 int cmp(double x, double y = 0, double tol = EPS) {
30 return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
33 const int MAXN = 405;
34 int mat[MAXN][MAXN];
36 vector<int> A[2 * MAXN], B[2 * MAXN];
38 int main(){
39 int n;
40 scanf("%d", &n);
41 for (int i = 0; i < n; ++i) {
42 for (int j = 0; j < n; ++j) {
43 scanf("%d", &mat[i][j]);
46 int ans = 0;
47 for (int i = 0; i < n; ++i) {
48 for (int j = 0; j < n; ++j) {
49 for (int delta = 0; i + delta < n and j + delta < n; ++delta) {
50 int option = 0;
51 for (int k = 0; k <= delta; ++k) {
52 option += mat[i+k][j+k];
53 option -= mat[i+k][j+delta-k];
55 ans = max(option, ans);
59 cout << ans << endl;
60 return 0;